﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace NRainel.Log
{
    public class NLog
    {
        private NLog()
        { }

        public static void ExceptionLog(Exception exc)
        {
            string logsDir = AppDomain.CurrentDomain.BaseDirectory + "\\Logs";

            if (!Directory.Exists(logsDir))
            {
                Directory.CreateDirectory(logsDir);
            }

            using (StreamWriter sw
                = new StreamWriter(logsDir + "\\ExcLog" + DateTime.Today.ToString("yyyy-MM-dd") + ".log", true))
            { 
                sw.WriteLine(string.Format("Time:{0}---------------------------------------------------------\r\n Error:{1}",DateTime.Now.ToString(),exc.ToString()));
            }
        }
    }
}
